<div id='leftcol'>
	
		<?php link_to('Manage Products', array('controller' => 'staff', 'action' => 'product')); ?>
		<br />
		<?php link_to('Manage Playgroundequipment', array('controller' => 'staff', 'action' => 'playgroundEquipment')); ?>
	
</div>
<div id='rightcol'>
</div>
<div id='centercol'>
<?php
start_form_tag('staff/viewProfile/');

$opts_arr_names = $opts_arr_companies = array('0-1' => 'Select Here');

foreach($this->customers as $customer) { $opts_arr_names['0' . $customer->id] = $customer->user->full_name();  $opts_arr_companies['0' . $customer->id] = $customer->user->company_name; }

$opts_arr_names = array_unique($opts_arr_names);
$opts_arr_companies = array_unique($opts_arr_companies);

radio_button_tag('customer_profile_search', 'customer_name_cb', true);
label('Customer Name', 'Name');
label_tag('customer-name', 'Customer Name');
select_tag('cust_name_cid', options_for_select($opts_arr_names ));
echo '<br />';
radio_button_tag('customer_profile_search', 'company_cb');
label_tag('company-name', 'Company Name');
select_tag('company_cid', options_for_select($opts_arr_companies));
echo '<br />';
submit_tag("Show Profile");

end_form_tag();
?>
<div>
<?php

if ($customer = $this->customer) {
		echo '<hr /><h2>';
	if (!empty($customer->user->company_name)) { echo $customer->user->company_name, ' - '; }
	echo $customer->user->full_name(), '</h2>',
	'<table>
	<tr><th colspan="2">Proforma Invoice</th><th colspan="2">Invoice</th></tr>
	<tr><th>ID</th><th>Created Date</th><th>ID</th><th>Created Date</th></tr>';
	foreach($customer->performainvoices as $performa) {
		echo '<tr><td>',link_to($performa->id, array('controller' => 'public', 'action' => 'performaInvoice', 'id' => $performa->id)),'</td><td>',$performa->created_date,'</td>',
		($performa->invoice) ? '<td>'.link_to($performa->invoice->id, array('controller' => 'public', 'action' => 'invoice', 'id' => $performa->invoice->id)).'</td><td>'.$performa->invoice->created_date
		: '<td>-</td><td>'.((strtotime($performa->created_date . ' +1 month') < $_SERVER['REQUEST_TIME']) ? 'Performa Expired.' : link_to('Make Invoice', array('controller' => 'public', 'action' => 'makeInvoice', 'id' => $performa->id)));
	}
	echo '</td></tr></table>';

}

?>
</div>
</div>

